#pragma once

class CAttach
{
	HANDLE GetProcessHandleWithEnoughRights(DWORD PID, DWORD AccessRights);
	BOOL EnableTokenPrivilege(HANDLE htok, LPCTSTR szPrivilege, TOKEN_PRIVILEGES& tpOld);
	BOOL RestoreTokenPrivilege(HANDLE htok, const TOKEN_PRIVILEGES& tpOld);
	BOOL AdjustDacl(HANDLE h, DWORD DesiredAccess);
public:
	CAttach(void);
	~CAttach(void);

	BOOL AttachDll(HWND hWndWow, HWND hWndExe, LPCTSTR lpDllName, DWORD dwShareId, LONG iInstances=-1);
	BOOL AttachDll(DWORD dwPID, LPCTSTR lpDllName);
    HANDLE OpenPro(CString strExe, DWORD& pid);
    //BOOL IsWowMainWnd(HWND hWnd);
	//BOOL HasAttackDll(DWORD dwProcessId, LPCTSTR lpDllName);
	//BOOL EjectDll(LPCTSTR lpDllName);
	DWORD m_dwProcessId;
	CString mDllPath;
};
